:- module(sockets).
:- export stream_select / 3.
:- export current_host / 1.
:- export socket_select / 5.
:- export socket_accept / 2.
:- export socket_listen / 2.
:- export socket_connect / 3.
:- export socket_bind / 2.
:- export socket / 2.
:- comment(summary, "Sicstus compatible sockets interface").
:- comment(author, "Kish Shen, ECRC Munich").
:- comment(copyright, "Imperial College London and ICL").
:- comment(date, "$Date: 2001/09/13 17:48:58 $").
:- comment(desc, html("\n    Note that ECLiPSe provides its own built-in socket manipulation\n    predicates which provides similar functionality to this library.\n    <P>\n    This library is only provided for compatibility with the socket\n    manipulation predicates of SICStus Prolog. To use these predicates,\n    the sockets library has to be loaded: \n    <PRE>\n    :- use_module(library(sockets)).\n    </PRE>\n    For SICStus 3.0, the sockets predicates are also in a sockets library,\n    so no changes are needed to load the library.  However, for older\n    versions of SICStus, the predicates are available as built-ins, and no\n    library has to be loaded.  So if the code is written for older\n    versions of SICStus, then the above line has to be added. \n    <P>\n    The sockets library can be used independently of the sicstus library. \n    ")).
:- comment(current_host / 1, [template : "current_host(?HostName)", summary : "Get the host machine name", see_also : [get_flag / 2]]).
:- comment(socket / 2, [template : "socket(+Domain, -Socket)", summary : "Create a socket", see_also : [socket / 3]]).
:- comment(socket_accept / 2, [template : "socket_accept(+Socket, -Stream)", summary : "Extract the first connection to socket", see_also : [accept / 3]]).
:- comment(socket_bind / 2, [template : "socket_bind(+Socket, +Address)", summary : "Bind a socket to an address", see_also : [bind / 2]]).
:- comment(socket_connect / 3, [template : "socket_connect(+Socket, +Address, -Stream)", summary : "Connect a socket to an address", see_also : [connect / 2]]).
:- comment(socket_listen / 2, [template : "socket_listen(+Socket, +Length)", summary : "Limit the maximum of pending connections", see_also : [listen / 2]]).
:- comment(socket_select / 5, [template : "socket_select(+Socket, -NewStream, +TimeOut0, +Streams, -ReadStreams)", summary : "Wait for new connection on Socket, and for data on Streams", see_also : [select / 3, stream_select / 3]]).
:- comment(stream_select / 3, [template : "stream_select(+Streams, +TimeOut0, -ReadStreams)", summary : "Wait for data on Streams", see_also : [select / 3]]).
